package com.tdd.zkconfig.listener;

import com.tdd.zkconfig.utils.DruidUtils;
import org.I0Itec.zkclient.IZkDataListener;

/**
 * @author tudedong
 * @description 数据源变化监听
 * @date 2020-06-14 15:15:06
 */
public class DataSourceChangeListener implements IZkDataListener {

    @Override
    public void handleDataChange(String s, Object o) throws Exception {
        System.out.println("注意：数据源信息发生变化！");
        DruidUtils.setDruidDataSource(null);
        DruidUtils.getInstance();
    }

    @Override
    public void handleDataDeleted(String s) throws Exception {

    }
}
